package com.liuzhilong.infrastructure.framework.spring;

import com.liuzhilong.infrastructure.framework.spring.component.*;
import com.liuzhilong.infrastructure.framework.spring.config.TestClass;
import org.springframework.cglib.core.DebuggingClassWriter;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * 启动项
 * @author longandai@163.com
 */
@ComponentScan
@EnableAspectJAutoProxy
public class Launcher {
    public static void main(String[] args) {
        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, "D:\\cglib\\gen");

        ConfigurableApplicationContext ctx	=	new AnnotationConfigApplicationContext(Launcher.class);
        ctx.start();
//        MyComponent myComponent= ctx.getBean(MyComponent.class);
//        myComponent.sayHello();
//        UnMarkComponet unMarkComponet= ctx.getBean(UnMarkComponet.class);
//        unMarkComponet.test();
//        TestBeanPostProcessorComponet componet = ctx.getBean("testBeanPostProcessorComponet",TestBeanPostProcessorComponet.class);
//        componet.print();
//        TestAopTarget testAopTarget = ctx.getBean(TestAopTarget.class);
//        testAopTarget.doSome("name");
//        System.out.println(ctx.getBean(TestAopTarget.class).doSome("name"));
//        ctx.getBean(FactoryBeanProduce.class).show();

        System.out.println("容器启动完毕");
        System.out.println(ctx.getBean(TestClass.class).getAnInt());




        ctx.close();
        ctx.stop();

    }
}
